home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / Gooey 1.2 / Gooey 68K ƒ / C++ Templates / ModelessDialog.c < prev    next >
Encoding:
Text File  |  1994-04-14  |  4.7 KB  |  195 lines  |  [TEXT/KAHL]

  1. $$Loop ModelessDialogs
  2. $$Message User Modeless Dialog, u:$Worksheet.name$.cp
  3.  
  4. $$File u:$Worksheet.name$.cp
  5. /*  $Worksheet.name$                                 Handle this dialog */
  6. /*  $CopyRight$ */
  7.  
  8. /*    File name:  $Worksheet.name$
  9.     Function:  Handle this modeless dialog.
  10.  
  11.     This dialog is called when:
  12.  
  13.     History: $Date$ Original by $Author$
  14.  
  15. */
  16.  
  17. #include "mmCommon$Prototype.name$.h"    /* Common */
  18. #include "Common$Prototype.name$.h"        /* Common */
  19.  
  20. /* ======================================================= */
  21. /* ======================================================= */
  22.  
  23. void CMD$Worksheet.name$::Init()
  24. {
  25. inherited::Init();
  26. }
  27.  
  28. $$if Option.EXTRAHOOKS
  29. /* ======================================================= */
  30.  
  31. /* Purpose: This procedures purpose is to open this window and set all */
  32. /* of the initial conditions, such as default edit text. */
  33.  
  34. void CMD$Worksheet.name$::OpenExtras()
  35. {
  36. inherited::OpenExtras();
  37. }
  38.  
  39. /* ======================================================= */
  40.  
  41. /* Purpose: This procedures purpose is to refresh this window, update it, */
  42. /* when we are uncovered by another window.  */
  43.  
  44. void CMD$Worksheet.name$::UpdateExtras()
  45. {
  46. inherited::UpdateExtras();
  47. }
  48.  
  49. /* ======================================================= */
  50.  
  51. /* Purpose: This procedures purpose is to close this window and clear */
  52. /* the window pointer variable */
  53.  
  54. void CMD$Worksheet.name$::Close(WindowPtr theWindow)
  55. {
  56.  
  57.  
  58. if ((this->theWindow != NIL) && (theWindow == this->theWindow))/* Only close if it is us and we were open */
  59.     {
  60.     }
  61.  
  62. inherited::Close(theWindow);
  63. }
  64.  
  65. /* ======================================================= */
  66.  
  67. /* Routine: HandleEvent */
  68. /* Purpose: This procedures purpose is to handle all actions, such as buttons being pressed. */
  69. /* This is the real meat of this unit and is where the code is for acting upon the users actions. */
  70.  
  71. void CMD$Worksheet.name$::HandleEvent(EventRecord *theEvent,WindowPtr theWindow,short itemHit)
  72. {
  73. DialogPtr        theDialog;
  74. Point            myPt;                                /* For the local mouse position */
  75. short            DType;                                /* Type of dialog item */
  76. Handle            DItem;                                /* Handle to the dialog item */
  77. Rect            tempRect;                            /* Temporary rectangle */
  78. ControlHandle    CItem;                                /* Control handle */
  79.  
  80.  
  81. inherited::HandleEvent(theEvent,theWindow,itemHit);
  82.  
  83. $$if HasLists
  84. if ((theEvent->what == mouseDown) && (this->theWindow != nil))
  85.     {
  86.     SetPort(this->theWindow);                    /* Set the port to our dialog */
  87.     myPt = theEvent->where;                            /* Get the position where the mouse was pressed */
  88.     GlobalToLocal(&myPt);                            /* Change from global to local location */
  89.  
  90.     $$Loop Control.type = List
  91.     if (PtInRect(myPt,&this->ListRect_$Control.name$))
  92.         {
  93.         /* List is    this->List_$Control.name$    */
  94.         }
  95.  
  96.     $$EndLoop Control.type
  97.     }
  98. $$endif HasLists
  99.  
  100. if ((this->theWindow != nil)  && (this->theWindow  == theWindow))
  101.     {
  102.     theDialog = this->theWindow;
  103.     
  104.     if (itemHit > 0)                                /* Skip if user set to zero */
  105.         {
  106.         GetDItem(theDialog,itemHit,&DType,&DItem,&tempRect);/* Get which item was pressed */
  107.         CItem = (ControlHandle)DItem;                /* Change the pointer for getting to the control */
  108.         }
  109.     
  110.     /* Handle it real time */
  111.     $$Loop Control.type = Button
  112.     if (itemHit == ResD_$Control.name$)                /* Handle the Button being pressed */
  113.         {
  114.         }
  115.  
  116.     $$EndLoop Control.type
  117.     $$Loop Control.type = Checkbox
  118.     if (itemHit == ResD_$Control.name$)                /* Handle the checkbox being pressed */
  119.         {
  120.         if (this->Value_$Control.name$ == 0)
  121.             {
  122.             }
  123.         else
  124.             {
  125.             }
  126.         }
  127.  
  128.     $$EndLoop Control.type
  129.     $$Loop Control.type = UButton
  130.     if (itemHit == ResD_$Control.name$)                /* Handle the Button being pressed */
  131.         {
  132.         }
  133.  
  134.     $$EndLoop Control.type
  135.     $$Loop Control.type = UToggle
  136.     if (itemHit == ResD_$Control.name$)                /* Handle the checkbox being pressed */
  137.         {
  138.         if (this->Value_$Control.name$ == 0)
  139.             {
  140.             }
  141.         else
  142.             {
  143.             }
  144.         }
  145.  
  146.     $$EndLoop Control.type
  147.     $$Loop Control.type = Radio
  148.     if (itemHit == ResD_$Control.name$)            /* Handle the Radio being pressed */
  149.         {
  150.         }
  151.  
  152.     $$EndLoop Control.type
  153.     $$Loop Control.type = HotRect
  154.     $$if Control.HotSpot
  155.     if (itemHit == ResD_$Control.name$)                /* Handle the HotSpot being pressed */
  156.         {
  157.         }
  158.  
  159.     $$endif Control.HotSpot
  160.     $$EndLoop
  161.     $$Loop Control.type = Picture
  162.     $$if Control.NonGraphic
  163.     if (itemHit == ResD_$Control.name$)                /* Handle the Picture being pressed */
  164.         {
  165.         }
  166.  
  167.     $$endif Control.NonGraphic
  168.     $$EndLoop
  169.     $$Loop Control.type = Icon
  170.     $$if Control.NonGraphic
  171.     if (itemHit == ResD_$Control.name$)                /* Handle the Icon being pressed */
  172.         {
  173.         }
  174.  
  175.     $$endif Control.NonGraphic
  176.     $$EndLoop
  177.     $$Loop Control.type = Sicn
  178.     $$if Control.NonGraphic
  179.     if (itemHit == ResD_$Control.name$)                /* Handle the Sicn being pressed */
  180.         {
  181.         }
  182.  
  183.     $$endif Control.NonGraphic
  184.     $$EndLoop
  185.     }
  186.  
  187. }
  188. $$endif Option.EXTRAHOOKS
  189.  
  190. /* ======================================================= */
  191. /* ======================================================= */
  192. $$CloseFile
  193. $$EndLoop
  194.  
  195.